﻿Import-Module SQLPS -DisableNameChecking;
Set-Location "$env:HOMEDRIVE\$env:HOMEPATH";

$(  Invoke-Sqlcmd -MaxCharLength 131072 -ServerInstance DC1-vp-DBAdmin -InputFile "C:\Users\$env:USERNAME\Dropbox\SQLNerd\DBAdmin ToolKit\Management\RDCMan.sql")[0] | Out-File -FilePath "C:\Users\$env:USERNAME\OneDrive\Documents\RDCMan\BBAAviation_SQL.rdg";

$r= Invoke-Sqlcmd -MaxCharLength  65536 -ServerInstance DC1-vp-DBAdmin -InputFile "C:\Users\$env:USERNAME\Dropbox\SQLNerd\DBAdmin ToolKit\Management\SQL-Multi-Script.sql";
$r['Application.dat'] | Out-File -FilePath "\\DC1-vp-DBAdmin\$env:USERNAME\AppData\Roaming\Red Gate\SQL Multi Script 1\Application.dat";
$r['Project.sms'    ] | Out-File -FilePath "\\DC1-vp-DBAdmin\$env:USERNAME\AppData\Roaming\Red Gate\SQL Multi Script 1\Project.sms";

Copy-Item -Path "C:\Users\$env:USERNAME\Dropbox\SQLNerd\DBAdmin ToolKit\PoSh\WindowsPowerShell\Modules\DBAdmin_ToolKit\*.*" -Destination '\\DC1-vp-DBAdmin\C$\Program Files\WindowsPowerShell\Modules\DBAdmin_ToolKit\';
